<?php

declare(strict_types=1);

use Hyperf\DbConnection\Db;
use Hyperf\Database\Seeders\Seeder;

class MenuSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        if (!Db::table('menu')->where('id', 1)->exists()) {
            Db::table('menu')->insert([
                [
                    'id' => 1,
                    'parent_id' => 0,
                    'name' => '系统',
                    'sort' => 1,
                    'desc' => '系统信息管理',
                    'app' => 'admin',
                    'level' => 1,
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'id' => 2,
                    'parent_id' => 1,
                    'name' => '管理员模块',
                    'sort' => 1,
                    'desc' => '管理权限用户等操作',
                    'app' => 'admin',
                    'level' => 2,
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'id' => 3,
                    'parent_id' => 2,
                    'name' => '管理员管理',
                    'sort' => 1,
                    'desc' => '管理用户',
                    'app' => 'admin',
                    'level' => 3,
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'id' => 4,
                    'parent_id' => 2,
                    'name' => '角色管理',
                    'sort' => 2,
                    'desc' => '管理角色',
                    'app' => 'admin',
                    'level' => 3,
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'id' => 5,
                    'parent_id' => 2,
                    'name' => '菜单设置',
                    'sort' => 3,
                    'desc' => '管理菜单',
                    'app' => 'admin',
                    'level' => 3,
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'id' => 6,
                    'parent_id' => 2,
                    'name' => '操作日志',
                    'sort' => 4,
                    'desc' => '日志查看',
                    'app' => 'admin',
                    'level' => 3,
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'id' => 7,
                    'parent_id' => 0,
                    'name' => '产品',
                    'sort' => 1,
                    'desc' => '产品管理',
                    'app' => 'shop',
                    'level' => 1,
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'id' => 8,
                    'parent_id' => 7,
                    'name' => '管理产品',
                    'sort' => 1,
                    'desc' => '管理产品',
                    'app' => 'shop',
                    'level' => 2,
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'id' => 9,
                    'parent_id' => 8,
                    'name' => '管理产品',
                    'sort' => 1,
                    'desc' => '管理产品',
                    'app' => 'shop',
                    'level' => 3,
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'id' => 10,
                    'parent_id' => 7,
                    'name' => '产品分类',
                    'sort' => 2,
                    'desc' => '管理产品分类',
                    'app' => 'shop',
                    'level' => 2,
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'id' => 11,
                    'parent_id' => 7,
                    'name' => '产品标签',
                    'sort' => 3,
                    'desc' => '管理产品标签',
                    'app' => 'shop',
                    'level' => 2,
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'id' => 12,
                    'parent_id' => 7,
                    'name' => '产品规格',
                    'sort' => 4,
                    'desc' => '管理产品规格',
                    'app' => 'shop',
                    'level' => 2,
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'id' => 13,
                    'parent_id' => 10,
                    'name' => '产品分类',
                    'sort' => 1,
                    'desc' => '管理产品分类',
                    'app' => 'shop',
                    'level' => 3,
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'id' => 14,
                    'parent_id' => 11,
                    'name' => '产品标签',
                    'sort' => 1,
                    'desc' => '管理产品标签',
                    'app' => 'shop',
                    'level' => 3,
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ],
                [
                    'id' => 15,
                    'parent_id' => 12,
                    'name' => '产品规格',
                    'sort' => 1,
                    'desc' => '管理产品规格',
                    'app' => 'shop',
                    'level' => 3,
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s')
                ]
            ]);
        }
    }
}
